package cn.xf.controller;

import cn.xf.domain.SysLog;
import cn.xf.domain.UserInfo;
import cn.xf.service.ISysLogService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

/**
 * @author xiaofu
 * @date 2021-05-18 14:31
 * @email dearaf@163.com
 */
@RequestMapping("/sysLog")
@Controller
public class SysLogController {
    @Autowired
    private ISysLogService sysLogService;

    @RequestMapping("/findAll.do")
    public ModelAndView findAll(@RequestParam(name = "page", required = true, defaultValue = "1") Integer page, @RequestParam(name = "pageSize", required = true, defaultValue = "10") Integer pageSize) {
        ModelAndView mv = new ModelAndView();
        List<SysLog> sysLogs = sysLogService.findAllByPage(page,pageSize);
        PageInfo<SysLog> pageInfo = new PageInfo<SysLog>(sysLogs);
        mv.addObject("pageInfo", pageInfo);
        mv.setViewName("/log/syslog-list");
        return mv;
    }
}
